//
//  DatePickerBoot.swift
//  SwiftUIWidgetDemo
//
//  Created by alanzhangg on 2023/7/17.
//

import SwiftUI

struct DatePickerBoot: View {
    
    @State var date: Date = Date()
    
    var dateFormatter: DateFormatter{
        let formatter = DateFormatter()
        formatter.dateStyle = .short
        formatter.timeStyle = .long
        return formatter
        
    }
    
    var body: some View {
        VStack{
            Text(dateFormatter.string(from: date))
                .font(.title)
            
            DatePicker("hello", selection: $date, displayedComponents: .hourAndMinute)
            
            DatePicker("hello", selection: $date)
                .accentColor(.red)
                .foregroundStyle(.red)
                .datePickerStyle(.compact)
                
                
        }
        
    }
}

#Preview {
    DatePickerBoot()
}
